<?php

namespace Apps\Common\Models;

/**
 * 美容院服务项目Model
 * @author     chenxiaolin
 * @date        2016年1月19日
 * @version     2.0.0
 * @copyright   Copyright 2016 meelier.com
 */
class BeautyParlorService extends \PhalconPlus\Database\Model
{

    /**
     *
     * @var integer
     */
    public $service_id;

    /**
     *
     * @var integer
     */
    public $beauty_parlor_id;

    /**
     *
     * @var string
     */
    public $service_name;

    /**
     *
     * @var string
     */
    public $service_cover;

    /**
     *
     * @var string
     */
    public $service_description;

    /**
     *
     * @var string
     */
    public $service_intro;

    /**
     *
     * @var double
     */
    public $service_price;

    /**
     *
     * @var string
     */
    public $service_unit;

    /**
     *
     * @var integer
     */
    public $service_state;

    /**
     *
     * @var integer
     */
    public $service_is_sell;

    /**
     *
     * @var string
     */
    public $service_addtime;

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->belongsTo('beauty_parlor_id', 'Apps\Common\Models\BeautyParlor', 'bp_id', array('alias' => 'BeautyParlor'));
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'beauty_parlor_service';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return BeautyParlorService[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return BeautyParlorService
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    /**
     * Independent Column Mapping.
     * Keys are the real names in the table and the values their names in the application
     *
     * @return array
     */
    public function columnMap()
    {
        return array(
            'service_id' => 'service_id',
            'beauty_parlor_id' => 'beauty_parlor_id',
            'service_name' => 'service_name',
            'service_cover' => 'service_cover',
            'service_description' => 'service_description',
            'service_intro' => 'service_intro',
            'service_price' => 'service_price',
            'service_unit' => 'service_unit',
            'service_state' => 'service_state',
            'service_is_sell' => 'service_is_sell',
            'service_addtime' => 'service_addtime',
        	'service_num' => 'service_num'
        		
        );
    }

    public function defaultColumns()
    {
        return [
            'service_price',
            'service_unit',
            'service_state',
            'service_is_sell',
            'service_addtime',
        ];
    }

}
